/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    overflow-x: hidden;
    user-select: none;
}

/* Main container - responsive height based on environment */
.container {
    width: 100%;
    height: 450px; /* Default for iframe */
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    position: relative;
}

/* Full browser tab height */
@media (min-height: 600px) {
    .container {
        height: 90vh;
    }
}

/* Flower container - central focus */
.flower-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
    position: relative;
    min-height: 200px;
}

/* Flower SVG styling */
.flower-svg {
    width: 100%;
    max-width: 300px;
    height: auto;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.1));
}

/* Drop zones - invisible interactive areas */
.drop-zone {
    fill: transparent;
    stroke: transparent;
    stroke-width: 2;
    cursor: pointer;
    transition: all 0.3s ease;
}

.drop-zone:hover {
    fill: rgba(255, 255, 0, 0.2);
    stroke: #ffd700;
    stroke-dasharray: 5,5;
}

.drop-zone.highlight {
    fill: rgba(76, 175, 80, 0.3);
    stroke: #4caf50;
    stroke-width: 3;
    stroke-dasharray: 5,5;
    animation: pulse 1s infinite;
}

.drop-zone.correct {
    fill: rgba(76, 175, 80, 0.4);
    stroke: #4caf50;
    stroke-width: 3;
}

.drop-zone.incorrect {
    fill: rgba(244, 67, 54, 0.3);
    stroke: #f44336;
    stroke-width: 3;
}

/* Word cards container */
.word-cards-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 10px;
    max-width: 100%;
}

/* Individual word cards */
.word-card {
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 8px 12px;
    cursor: grab;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    min-width: 120px;
    text-align: center;
    position: relative;
}

.word-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    border-color: #2196f3;
}

.word-card:active {
    cursor: grabbing;
    transform: scale(1.05);
}

.word-card.dragging {
    opacity: 0.8;
    transform: rotate(5deg);
    z-index: 1000;
}

.word-card.placed {
    opacity: 0.5;
    pointer-events: none;
    background: #e8f5e8;
    border-color: #4caf50;
}

/* Word card text styling */
.word-text {
    display: block;
    font-weight: bold;
    font-size: 14px;
    color: #333;
    margin-bottom: 4px;
}

.function-text {
    display: block;
    font-size: 11px;
    color: #666;
    line-height: 1.2;
}

/* Control buttons */
.controls {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 40px;
    white-space: nowrap;
}

.check-btn {
    background: linear-gradient(145deg, #4caf50, #45a049);
    color: white;
}

.check-btn:hover {
    background: linear-gradient(145deg, #45a049, #3d8b40);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3);
}

.reset-btn {
    background: linear-gradient(145deg, #ff9800, #f57c00);
    color: white;
}

.reset-btn:hover {
    background: linear-gradient(145deg, #f57c00, #ef6c00);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(255, 152, 0, 0.3);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Feedback area */
.feedback {
    min-height: 30px;
    padding: 8px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.3s ease;
}

.feedback.success {
    background: rgba(76, 175, 80, 0.1);
    color: #2e7d32;
    border: 2px solid #4caf50;
}

.feedback.error {
    background: rgba(244, 67, 54, 0.1);
    color: #c62828;
    border: 2px solid #f44336;
}

.feedback.partial {
    background: rgba(255, 152, 0, 0.1);
    color: #f57c00;
    border: 2px solid #ff9800;
}

/* Tooltip styling */
.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    max-width: 200px;
    text-align: center;
}

.tooltip.show {
    opacity: 1;
}

/* Connection lines */
.connection-line {
    stroke: #2196f3;
    stroke-width: 3;
    fill: none;
    stroke-dasharray: 5,5;
    animation: dash 1s linear infinite;
}

.connection-line.correct {
    stroke: #4caf50;
    stroke-dasharray: none;
    animation: none;
}

/* Animations */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

@keyframes dash {
    to { stroke-dashoffset: -10; }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .container {
        padding: 5px;
    }
    
    .word-card {
        min-width: 100px;
        padding: 6px 8px;
    }
    
    .word-text {
        font-size: 12px;
    }
    
    .function-text {
        font-size: 10px;
    }
    
    .btn {
        padding: 6px 12px;
        font-size: 12px;
        min-height: 36px;
    }
    
    .flower-svg {
        max-width: 250px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .drop-zone {
        r: 30; /* Larger touch targets */
    }
    
    .word-card {
        min-height: 44px; /* iOS recommended touch target */
        padding: 10px 12px;
    }
    
    .btn {
        min-height: 44px;
        padding: 10px 16px;
    }
}